/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ChArFaTo
 */
@Entity
@Table(name = "nota", catalog = "proyectosw", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NotaEJB.findAll", query = "SELECT n FROM NotaEJB n"),
    @NamedQuery(name = "NotaEJB.findByNIdNota", query = "SELECT n FROM NotaEJB n WHERE n.nIdNota = :nIdNota"),
    @NamedQuery(name = "NotaEJB.findByNnota", query = "SELECT n FROM NotaEJB n WHERE n.nnota = :nnota"),
    @NamedQuery(name = "NotaEJB.findByNaprobado", query = "SELECT n FROM NotaEJB n WHERE n.naprobado = :naprobado")})
public class NotaEJB implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer nIdNota;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private float nnota;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private boolean naprobado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "notaEJB")
    private Collection<HistorialnotaEJB> historialnotaEJBCollection;

    public NotaEJB() {
    }

    public NotaEJB(Integer nIdNota) {
        this.nIdNota = nIdNota;
    }

    public NotaEJB(Integer nIdNota, float nnota, boolean naprobado) {
        this.nIdNota = nIdNota;
        this.nnota = nnota;
        this.naprobado = naprobado;
    }

    public Integer getNIdNota() {
        return nIdNota;
    }

    public void setNIdNota(Integer nIdNota) {
        this.nIdNota = nIdNota;
    }

    public float getNnota() {
        return nnota;
    }

    public void setNnota(float nnota) {
        this.nnota = nnota;
    }

    public boolean getNaprobado() {
        return naprobado;
    }

    public void setNaprobado(boolean naprobado) {
        this.naprobado = naprobado;
    }

    @XmlTransient
    public Collection<HistorialnotaEJB> getHistorialnotaEJBCollection() {
        return historialnotaEJBCollection;
    }

    public void setHistorialnotaEJBCollection(Collection<HistorialnotaEJB> historialnotaEJBCollection) {
        this.historialnotaEJBCollection = historialnotaEJBCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nIdNota != null ? nIdNota.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NotaEJB)) {
            return false;
        }
        NotaEJB other = (NotaEJB) object;
        if ((this.nIdNota == null && other.nIdNota != null) || (this.nIdNota != null && !this.nIdNota.equals(other.nIdNota))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Modelo.NotaEJB[ nIdNota=" + nIdNota + " ]";
    }
    
}
